<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<html>
	<head>
		<title>历史数据</title>
	</head>
	<script type="text/javascript">
		$(function(){
			$("#table").datagrid({
				title:"历史数据",
				iconCls:'icon-edit',
				loadMsg:'正在加载数据，请稍后......',
				url:'<%=contextPath %>/springMVC/statistic/listPageHistory',
				rownumbers:true,
				nowrap:false,
			//	fitColumns:true,
				frozenColumns:[[
					{title:'主键',field:'id',hidden:true},
				    {title:'项目编号',field:'xm_code',width:100,align:'center'},
					{title:'建设单位编号',field:'construct_code',width:100,align:'center'},
					{title:'项目名称',field:'xm_name',width:100,align:'center'}
				]],
				columns:[
					[
						{title:'基础信息',width:700,align:'center',colspan:7},
						{title:'收入信息',width:300,align:'center',colspan:3},
						{title:'施工支出信息',width:500,align:'center',colspan:5},
						{title:'材料支出信息',width:300,align:'center',colspan:3},
						{title:'其他支出信息',width:300,align:'center',colspan:3},
						{title:'管理费',width:100,align:'center',rowspan:3,field:'manage_money'},
						{title:'税金',width:100,align:'center',rowspan:3,field:'tax'},
						{title:'毛利',width:100,align:'center',rowspan:3,field:'profit'},
						{title:'备注',width:100,align:'center',rowspan:3,field:'remark'}
					],
					[
						{title:'归属部门',width:100,align:'center',rowspan:2,field:'dept_name'},
						{title:'专业分类',width:100,align:'center',rowspan:2,field:'prof_type'},
						{title:'专业明细',width:100,align:'center',rowspan:2,field:'prof_detail'},
						{title:'客户单位',width:100,align:'center',rowspan:2,field:'customer'},
						{title:'客户部门',width:100,align:'center',rowspan:2,field:'customer_dept'},
						{title:'甲方负责人',width:100,align:'center',rowspan:2,field:'customer_amdin'},
						{title:'实物工程量',width:100,align:'center',rowspan:2,field:'xm_content'},
						{title:'预算应收款',width:100,align:'center',rowspan:2,field:'assume_receive'},
						{title:'实际结款调整（多正少负）',width:100,align:'center',rowspan:2,field:'adjust_factor'},
						{title:'已收款',width:100,align:'center',rowspan:2,field:'already_receive'},
						{title:'预算应付款',width:100,align:'center',colspan:2},
						{title:'实际付款调整（多负少正）',width:100,align:'center',colspan:2},
						{title:'已付款',width:100,align:'center',rowspan:2,field:'already_worker_money'},
						{title:'预算应付款',width:100,align:'center',rowspan:2,field:'assume_material_money'},
						{title:'实际付款调整（多负少正）',width:100,align:'center',rowspan:2,field:'adjust_material_moeny'},
						{title:'已付款',width:100,align:'center',rowspan:2,field:'already_material_money'},
						{title:'预算应付款',width:100,align:'center',rowspan:2,field:'assume_other_money'},
						{title:'实际付款调整（多负少正）',width:100,align:'center',rowspan:2,field:'adjust_other_money'},
						{title:'已付款',width:100,align:'center',rowspan:2,field:'already_other_money'}
					],
					[
						{title:'分包单位',width:100,align:'center',field:'assume_worker_money_1'},
						{title:'班组',width:100,align:'center',field:'assume_worker_money_2'},
						{title:'分包单位',width:100,align:'center',field:'adjust_worker_money_1'},
						{title:'班组',width:100,align:'center',field:'adjust_worker_money_2'}
					]
				],
				view: detailview,
				detailFormatter:function(index,row){
					return '<div style="padding:2px"><table class="ddv"></table></div>';
				},
				onExpandRow: function(index,row){
					var xm_id = row.id;
					var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
					var url="<%=contextPath%>/springMVC/statistic/listPageGd?xm_id="+xm_id;
					 ddv.datagrid({
						title:'工单明细',
						url:url,
						loadMsg:'正在加载数据，请稍后......',
						fitColumns:true,
						rownumbers:true,
						columns:[[
							{title:'工单编号',field:'gd_code',width:100,align:'center'},
							{title:'工单名称',field:'gd_name',width:100,align:'center'},
							{title:'工单负责人',field:'gd_admin',width:100,align:'center'},
							{title:'实施单位',field:'gd_worker',width:100,align:'center'},
							{title:'实施负责人',field:'gd_worker_admin',width:100,align:'center'},
							{title:'开工时间',field:'gd_start_work_time',width:100,align:'center'},
							{title:'计划完工时间',field:'gd_assume_end_time',width:100,align:'center'},
							{title:'实际完工时间',field:'gd_actual_end_time',width:100,align:'center'},
							{title:'主要工程量',field:'gd_content',width:100,align:'center'},
							{title:'总工日',field:'gd_total',width:100,align:'center'},
							{title:'施工支出',field:'gd_work_money',width:100,align:'center'},
							{title:'材料支出',field:'gd_material_money',width:100,align:'center'},
							{title:'其他支出',field:'gd_other_money',width:100,align:'center'}
						]],
						pageSize:10,
						pageList : [10,50,100],  
						pagination:true,
					 	onResize:function(){
					        $('#table').datagrid('fixDetailRowHeight',index);
					    },
					 	onLoadSuccess:function(){
					       setTimeout(function(){
					         $('#table').datagrid('fixDetailRowHeight',index);
					       },0);
					   }
					 });
					 $('#table').datagrid('fixDetailRowHeight',index);
				},
				pageSize:10,
				pageList : [10,50,100],  
				pagination:true,
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						$.messager.alert('提示',rtJson.rtMsrg);
					}
				}
			});
		});
			
		function doQuery(){
			var xm_code = $('#xm_code').val();
			var construct_code = $('#construct_code').val();
			var xm_name = $('#xm_name').val();
			var dept_name = $('#dept_name').val();
			var prof_type = $('#prof_type').val();
			var prof_detail = $('#prof_detail').val();
			var customer = $('#customer').val();
			$('#table').datagrid('load', {
				xm_code : xm_code,
				construct_code : construct_code,
				xm_name : xm_name,
				dept_name : dept_name,
				prof_type : prof_type,
				prof_detail : prof_detail,
				customer : customer
			});
		}
		function showGD(gd_id,gd_content_id){
			openDialogResize('<%=contextPath%>/springViews/gd/showGd.jsp?gd_id='+gd_id+'&gd_content_id='+gd_content_id,1000, 800);
		}
	</script>
	<body >
	<div class="easyui-panel" title="查询条件">
			<table style="width:80%;" >
				<tr>
					<td align="left"  nowrap class="td1">
						项目编号：
					</td>
					<td class="td2" nowrap>
						<input id="xm_code" name="xm_code" />
					</td>
					<td align="left"  nowrap class="td1">
						建设单位编号：
					</td>
					<td class="td2" nowrap>
						<input id="construct_code" name="construct_code" />
					</td>
					<td align="left"  nowrap class="td1">
						项目名称：
					</td>
					<td class="td2" nowrap>
						<input id="xm_name" name="xm_name" />
					</td>
					<td align="left"  nowrap class="td1">
						归属部门：
					</td>
					<td class="td2" nowrap>
						<input id="dept_name" name="dept_name" />
					</td>
				</tr>
				<tr>
					<td align="left"  nowrap class="td1">
						专业分类：
					</td>
					<td class="td2" nowrap>
						<input id="prof_type" name="prof_type" />
					</td>
					<td align="left"  nowrap class="td1">
						专业明细：
					</td>
					<td class="td2" nowrap>
						<input id="prof_detail" name="prof_detail" />
					</td>
					<td align="left"  nowrap class="td1">
						客户单位：
					</td>
					<td class="td2" nowrap>
						<input id="customer" name="customer" />
					</td>
				</tr>
				<tr>
				<td  nowrap align="right">
						<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:false" onclick="doQuery();">查询</a>
					</td>
				</tr>
			</table>
		</div>
	<div id="table" ></div>
</body>
</html>